Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Address layer / image extraction issues in user namespaces (4.1) #2701

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

dtrudg
Copy link
Member

@dtrudg dtrudg commented Mar 4, 2024

Description of the Pull Request (PR):

Pick #2699

Note - there are no e2e tests for the nested containers / nested namespaces situations that are fixed by the commits in this PR. However, our e2e tests do confirm the changes don't cause regressions in non-nested cases.

The e2e framework doesn't offer a great way of executing singularity nested, and I've opened an issue (#2700) to address this to verify functionality more generally than a messy one-off for this PR would handle.

fix: use rootless umoci inside user namespace

If we are running from within a user namespace, then use rootless OCI layer extrraction with umoci.

This permits the extraction to complete when singularity is run under unshare -r.

fix: honor --userns in unsquashfs wrapping

If singularity is executed with --userns/-u then it should also use a user namespace where it executes unsquashfs in a wrapped manner.

Previously the unsquashfs wrapping was without --userns/-u in a setuid installation. This caused extraction to fail from within a non-root-mapped user namespace (e.g. unshare -c).

This fixes or addresses the following GitHub issues:

Before submitting a PR, make sure you have done the following:

dtrudg added 2 commits March 4, 2024 09:55
If we are running from within a user namespace, then use rootless OCI
layer with umoci.

This permits the extraction to complete when singularity is run under
`unshare -r`.

Part of sylabs#2698
If singularity is executed with `--userns/-u` then where possible it
should also use a user namespace where it executes `unsquashfs` in a
wrapped manner.

Previously the `unsquashfs` wrapping was without `--userns/-u` in a
setuid installation. This caused extraction to fail from within a
non-root-mapped user namespace (e.g. `unshare -c`).

Part of sylabs#2698
@dtrudg dtrudg added the bug Something isn't working label Mar 4, 2024
@dtrudg dtrudg added this to the SingularityCE 4.1.2 milestone Mar 4, 2024
@dtrudg dtrudg self-assigned this Mar 4, 2024
@dtrudg dtrudg marked this pull request as ready for review March 4, 2024 10:50
@dtrudg dtrudg merged commit 1cfcde1 into sylabs:release-4.1 Mar 4, 2024
1 check passed
@dtrudg dtrudg deleted the pick-2699 branch March 4, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants